import { _decorator, Component, EventTouch, instantiate, Node, NodePool, UITransform } from 'cc';
import { ComponentBase } from '../base/ComponentBase';
import { EventMgr } from '../../../../scripts/GlobalMessage';
import { KugoEvent } from '../KugoConst';

const { ccclass, property } = _decorator;
/**底部节点  */
@ccclass('BottomNode')
export class BottomNode extends ComponentBase {

    @property(Node)
    TipsNode:Node = null

    onLoad(): void {
        super.onLoad()
        this.hide()
    }

    start(): void {
        super.start()
    }

    protected onClickBtn(event:EventTouch, evenData:any){
        super.onClickBtn(event, evenData)
        EventMgr.send(KugoEvent.OnClickBottom,event.target.name)
        switch (event.target.name) {
            case "BtnConfirm":
                console.log("点击确定落子")
                break;
            case "BtnCancel":
                console.log("点击撤销")
                break;
            case "BtnBack":
                console.log("点击回退一步")
                break;
            default:
                break;
        }
        
    }
    
    show(){
        this.node.active = true
    }

    hide(){
        this.node.active = false
    }

    showTipsNode(){
        this.TipsNode.active = true
    }
}